import request from '@/utils/request';
import type { AccountParams, SaveAccountParams, AuthParams, DelParams, UpdateParams } from './data.d';

// 账号列表
export async function getAccountList(params?: AccountParams) {
  return request('/api/sem/account/list', {
    method: 'POST',
    data: params
  });
}

// 新增账号
export async function saveAccount(params?: SaveAccountParams) {
  return request('/api/sem/account/add', {
    method: 'POST',
    data: params
  });
};

// 授权账号
export async function auth(params: AuthParams) {
  return request('/api/sem/account/auth', {
    method: 'POST',
    params: {
      ...params
    }
  });
};

// 删除账号
export async function del(params: DelParams) {
  return request('/api/sem/account/delete', {
    method: 'POST',
    data: params
  });
};

// 获取账号详情
export async function getAccount(params: DelParams) {
  // console.log(params)
  return request('/api/sem/account/detail', {
    method: 'POST',
    params: {
      ...params
    }
  });
};

// 修改账号
export async function updateAccount(params: UpdateParams) {
  return request('/api/sem/account/detail', {
    method: 'POST',
    params: {
      ...params
    }
  });
}